package com.novel;

import java.util.Scanner;

public class test {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String s = sc.next();
            int weight = findAllSubstrings(s, s.length());
            System.out.println(weight);
        }
    }

    public static int findAllSubstrings(String str,int length){
        int weight = 0;
        for(int i = 0 ; i < length ; i++ ){
            for(int j = 1 ; j <= length - i ; j++ ){
                String sub = str.substring(i, i+j);
                weight += calculateWeight(sub);
            }
        }
        return weight;
    }

    public static int calculateWeight(String s){
        int res1 = 0;
        int res2 = 0;
        int res3 = 0;
        int res4 = 0;

        char c = s.charAt(0);

        for(int i = 0;i < s.length();i++){
            char current = s.charAt(i);
            if(i % 2 == 0){
                if(c != current){
                    res1 += (i + 1);
                    res3++;
                }else{
                    res2 += (i + 1);
                    res4++;
                }
            }else{
                if(c == current){
                    res1 += (i + 1);
                    res3++;
                }else{
                    res2 += (i + 1);
                    res4++;
                }
            }
        }
        return Math.min(res3, res4);
    }

}